$OpenBSD: patch-lex_l,v 1.2 2017/05/05 22:11:08 naddy Exp $
Index: lex.l
--- lex.l.orig
+++ lex.l
@@ -37,12 +37,26 @@
  ***********************************************************************/
 
 /* #include <stdio.h> */		/* lex already includes stdio.h */
+#include "twm.h"
 #include "gram.h"
 #include "parse.h"
 extern char *ProgramName;
 
 extern int ParseError;
 
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	{ \
+		int res = (*twmInputFunc)(); \
+		if (res == 0) \
+			result = YY_NULL; \
+		else \
+		{ \
+			buf[0] = res; \
+			result = 1; \
+		} \
+	}
+
 %}
 
 string				\"([^"]|\\.)*\"
@@ -94,14 +108,14 @@ number				[0-9]+
 				}
 %%
 #ifndef yywrap
-yywrap() { return(1);}
+int yywrap() { return(1);}
 #endif
 
 #undef unput
-#undef input
+/*#undef input*/
 #undef output
 #undef feof
 #define unput(c)	twmUnput(c)
-#define input()		(*twmInputFunc)()
+/*#define input()		(*twmInputFunc)()*/
 #define output(c)	TwmOutput(c)
 #define feof()		(1)
